using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using PotatoSoft.ViewModel.Messages;
using GalaSoft.MvvmLight.Messaging;
using System.Windows;

namespace PotatoSoft.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class MainViewModel : ViewModelBase
    {
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}
        }

        #region main window rendered command
        private RelayCommand mainWindowRenderedCommand;
        public RelayCommand MainWindowRendered
        {
            get
            {
                if (mainWindowRenderedCommand == null)
                {
                    mainWindowRenderedCommand = new RelayCommand(() =>
                    {
                        Messenger.Default.Send<MainWindowRenderedMessage>(new MainWindowRenderedMessage());
                    });
                }
                return mainWindowRenderedCommand;
            }
        }
        #endregion

        #region Menu View

        #region ProjectExplorerVisibility

        public const string ProjectExplorerVisibilityPropertyName = "ProjectExpVisibility";
        private Visibility projectExpVisibility = Visibility.Hidden;
        public Visibility ProjectExpVisibility
        {
            get { return projectExpVisibility; }
            set
            {
                if (projectExpVisibility == value)
                    return;
                projectExpVisibility = value;
                RaisePropertyChanged(ProjectExplorerVisibilityPropertyName);
            }
        }

        private RelayCommand _showProjectExplorer;
        public RelayCommand ShowProjectExplorer
        {
            get
            {
                if (_showProjectExplorer == null)
                    _showProjectExplorer = new RelayCommand(() =>
                    {
                        ProjectExpVisibility = Visibility.Visible;
                    });
                return _showProjectExplorer;
            }
        }

        #endregion

        #endregion
    }
}